<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>速查文档-vim</title>
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.1.0/github-markdown-light.min.css">
    <link rel="stylesheet" href="../css/center.css">
</head>
<body>
    <div id="$m" class="markdown-body"></div>
    <textarea id="$t" style="display:none">
# 模式

### 插入模式

|i |光标前插入( insert)|
|---|---|
|I |在行首插入|
|a |在光标前插入(append)|
|A |在行尾插入|
|o |在下一行插入(one line)|
|O |在上一行插入|
|ESC|	jj	Capslok 退出插入模式|

### 可视模式

|v| 进入|
|---|---|
|ESC	v| 退出|

### 命令模式

： 进入

ESC 退出



# 光标移动

普通模式下：

h ←	j ↓	k ↑	l →

| w    | 跳到下一个单词开头(word)         |
| ---- | :------------------------------- |
| b    | 跳到本单词或下一个单词结尾(back) |
|e	|跳到本单词或上一个单词开头(end)|
|ge	|跳到上一个单词结尾|
|0	|跳到行首|
|^	|跳到从行首开始第一个非空字符|
|$	|跳到行尾|
|gg	|跳到第一行|
|G	|跳到最后一行|



![image-20220203144707592](https://gitee.com/zxmh/files/raw/master/fs/img/vim/01b485d5d0a109664019ee84c7e0370b.png) 

# 操作符

![image-20220203145538127](https://gitee.com/zxmh/files/raw/master/fs/img/vim/af4ca98a31f2f538109af9a10b4863ec.png) 

# 操作符+动作

|p |粘贴|
|--|--|
|u |撤销动作+操作符|
|ciw |选中单词删除并进入插入模式|
|yiw |选中并复制单词|
|diw |选中并删除单词|
|ndd/ncc/nyy |向下删除/修改/复制n行,包括当前行|
|d/c/yf{char}| 删除/修改/复制到向后的char字符|
|d/c/y ^/$ |删除/修改/复制到开头/结尾|
|die |删除整个文件|
|cie |删除整个文件并进入写入模式|

v+各种操作（可以看到啥被选中了）+操作符（y/c/d）

# 大小写转换

<img src="https://gitee.com/zxmh/files/raw/master/fs/img/vim/3a6cb9f53dde063073ae57117d3daa80.png" alt="image-20220203155235967" style="zoom: 50%;" /> 

# tips

gd : goto [definition] 跳转到定义

gh ：go hover 鼠标悬浮到这里的效果

gt： tab ：下一个标签页

gT :上一个标签页

2gt 跳到第二个标签页

ctrl 0 ，左侧标签

在左侧标签 可以使用 h j k l space

分屏

ctrl + 1 2 3 到其中一个分屏
# easymotion
<leader>：初始是space

| <leader>  <leader> s <char> | Search character |
| -------------------------- | ---------------- |
|<leader><leader> f <char>|	Find character forwards|
|<leader><leader> F <char>|	Find character backwards|
|<leader><leader> t <char>| Til character forwards |
|<leader><leader> T <char>|	Til character backwards|
|<leader><leader> w|	Start of word forwards|
|<leader><leader> b|	Start of word backwards|
|<leader><leader> l	|Matches beginning & ending of word, camelCase, after _, and after # |
|<leader><leader> h	|Matches beginning & ending of word, camelCase, after _, and after # |
|<leader><leader> e	|End of word forwards|
|<leader><leader> ge|	End of word backwards|
|<leader><leader> j	|Start of line forwards|
|<leader><leader> k	|Start of line backwards|
|<leader><leader> / <char>... <CR>|	Search n-character|
|<leader><leader><leader> bdt	|Til character|
|<leader><leader><leader> bdw	|Start of word|
|<leader><leader><leader> bde	|End of word|
|<leader><leader><leader> bdjk	|Start of line|
|<leader><leader><leader> j|	JumpToAnywhere motion; default behavior matches beginning & ending of word, camelCase, after _ and after #|

## vim surround

![image-20220203172724688](https://gitee.com/zxmh/files/raw/master/fs/img/vim/c092ca12e07849735178c869c4d147c8.png) 

## 多光标操作

gbgb

这个不太好用 ，有个插件Auto Rename Tag，修改一个tag 另外一个跟着变

而且vscode 自动添加尾部的tag

    </textarea>
    <script>$m.innerHTML = marked.parse($t.value);</script>
</body>
</html>
